﻿using System;
using System.Collections.Generic;
using System.Linq;
using InvestmentIntelligence.DbModel.Models;

namespace InvestmentIntelligence.Data.Repository.EFImplementation
{
    public class BookSecurityToBenchmarkRepository : IIPRepository<BookSecurityToBenchmark>, IBookSecurityToBenchmarkRepository
    {
        private const int MergeTimeout = 1000;

        public IEnumerable<BookSecurityToBenchmark> GetFundBookBenchmarks(int fundBookId)
        {
            return GetList(c => c.Where(r => r.FundBookEntityId == fundBookId));
        }

        public List<T> Get<T>(Func<IQueryable<BookSecurityToBenchmark>, IEnumerable<T>> f)
        {
            return GetList(f);
        }

        public new void Merge(IEnumerable<BookSecurityToBenchmark> items)
        {
            Merge(items, MergeTimeout);
        }
    }
}